/*
	@author: Nicolas Santamaria
	@date  : 16/09/08
	@what  : Socket Client
*/

#include "TCPSocketClient.h"

namespace Network
{
	TCPSocketClient::TCPSocketClient()
	{}

	void TCPSocketClient::connect(std::string p_addr, unsigned short p_port)
	{
		m_peerAddr.set(p_port, p_addr.c_str());

		m_connector.connect(m_stream, m_peerAddr);

#ifdef _DEBUG
		cout << "Connection done with " << p_addr << ':' << p_port << endl;
#endif
	}

	int TCPSocketClient::send(void *p_buffer, unsigned int p_size)
	{
		cout << "Try to send " << p_size << "bytes " << endl;

		return m_stream.send_n(p_buffer, p_size);
	}
}